<script setup lang="ts">
import { AnswerItem, Question } from "../../index.d.ts";
import { ref } from "vue";

const props = defineProps<{ tk: Question; index: number }>();
const emit = defineEmits(["hasAnswer"]);
const answerItem = ref<AnswerItem>({
  questionID: props.tk.id,
  content: "",
  type: props.tk.type,
});
</script>

<template>
  <div class="question-title">
    {{ index + 1 }}.{{ tk.title }}
    <!-- <span class="text-red-600">(本题的难度为{{ tk.difficulty }})</span> -->
  </div>
  <el-form-item class="question-content">
    <el-input
      type="textarea"
      v-model="answerItem.content"
      @change="() => emit('hasAnswer', answerItem)"
    />
  </el-form-item>
</template>

<style scoped></style>
